package com.macro.cloud.intecepter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HeaderInterceptor extends HandlerInterceptorAdapter {

    Logger log = LoggerFactory.getLogger(HeaderInterceptor.class);
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        log.info("进入到拦截器AccessLogInterceptor中:preHandle() 方法");
        response.setHeader("cuid","abc");
        log.info("请求结束");
        return true;
    }

}